$(document).ready(function(){
	$('.error').delay(4000);
	$('.error').fadeOut('slow'); // reset the error messages (hides them)
	$('.error_msg').delay(4000);
	$('.error_msg').fadeOut('slow'); // reset the error messages (hides them)
	$('.success_msg').delay(4000);
	$('.success_msg').fadeOut('slow'); // reset the error messages (hides them)
	
	$('input').attr('autocomplete','off');
	
	$("#login_btn").click(function(){
		var email_compare = /^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,12})$/; // Syntax to compare against input
		var email = $('input#email2').val().toLowerCase(); // get the value of the input field
		var pass = $('input#password').val(); // get the value of the input field
		if (email == "" || email == " " || email == "E-mail") { // check if the field is empty
			$('#err-emailvld').html('Please enter email');
			$('#err-emailvld').show(500);
		    $('#err-emailvld').delay(4000);
		    $('#err-emailvld').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });         
			error = true;
		}else if (!email_compare.test(email)) { // if it's not empty check the format against our email_compare variable
			$('#err-emailvld').html('Please enter a valid Email');
		    $('#err-emailvld').show(500);
		    $('#err-emailvld').delay(4000);
		    $('#err-emailvld').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });         
			error = true;
		}else if (pass == "" || pass == " " || pass == "Password") { // check if the field is empty
			$('#err-name').html('Please enter password');
			$('#err-name').show(500);
		    $('#err-name').delay(4000);
		    $('#err-name').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    }); 
			error = true;
		}else {
			$("#login_form").submit();
		}
	});
	
	//---handle enter key
	$('#password').keypress(function(event){
		var keycode = (event.keyCode ? event.keyCode : event.which);
		if(keycode == '13'){
			var email_compare = /^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,12})$/; // Syntax to compare against input
			var email = $('input#email2').val().toLowerCase(); // get the value of the input field
			var pass = $('input#password').val(); // get the value of the input field
			if (email == "" || email == " " || email == "E-mail") { // check if the field is empty
				$('#err-emailvld').html('Please enter email');
				$('#err-emailvld').show(500);
			    $('#err-emailvld').delay(4000);
			    $('#err-emailvld').animate({
			      height: 'toggle'  
			    }, 500, function() {
			      // Animation complete.
			    });         
				error = true;
			}else if (!email_compare.test(email)) { // if it's not empty check the format against our email_compare variable
				$('#err-emailvld').html('Please enter a valid Email');
			    $('#err-emailvld').show(500);
			    $('#err-emailvld').delay(4000);
			    $('#err-emailvld').animate({
			      height: 'toggle'  
			    }, 500, function() {
			      // Animation complete.
			    });         
				error = true;
			}else if (pass == "" || pass == " " || pass == "Password") { // check if the field is empty
				$('#err-name').html('Please enter password');
				$('#err-name').show(500);
			    $('#err-name').delay(4000);
			    $('#err-name').animate({
			      height: 'toggle'  
			    }, 500, function() {
			      // Animation complete.
			    }); 
				error = true;
			}else {
				$("#login_form").submit();
			}
		}
	});
	
	$("#event_btn").click(function(){
		var name_pattern=/^[A-Za-z0-9][A-Za-z0-9&.)(\-\, ]+$/;
		if($("#eventname").val() =="" || $("#eventname").val() == " " || $("#eventname").val() == 'Event Name')
		{
			$('#err-name').html('Please enter Event Name');
			$('#err-name').show(500);
			$('#err-name').delay(4000);
		    $('#err-name').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#eventname").focus();
		}/*else if(!name_pattern.test($("#eventname").val())){
			$('#err-name').html('Please enter valid Event Name');
			$('#err-name').show(500);
			$('#err-name').delay(4000);
		    $('#err-name').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#eventname").focus();
		}*/
		else
		{
			$("#event_form").submit();
		}
	});
	
	$("#event_edit_btn").click(function(){
		var name_pattern=/^[A-Za-z0-9][A-Za-z0-9&.)(\-\, ]+$/;
		if($("#eventname").val() =="" || $("#eventname").val() == " " || $("#eventname").val() == 'Event Name')
		{
			$('#err-name').html('Please enter Event Name');
			$('#err-name').show(500);
			$('#err-name').delay(4000);
		    $('#err-name').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#eventname").focus();
		}/*else if(!name_pattern.test($("#eventname").val())){
			$('#err-name').html('Please enter valid Event Name');
			$('#err-name').show(500);
			$('#err-name').delay(4000);
		    $('#err-name').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#eventname").focus();
		}*/
		else
		{
			$("#event_form").submit();
		}
	});
	
	$("#event_search_btn").click(function(){
		var name_pattern=/^[A-Za-z0-9][A-Za-z0-9&.)(\-\, ]+$/;
		if($("#event_search_name").val() =="" || $("#event_search_name").val() == " " || $("#event_search_name").val() == 'Enter Event Name')
		{
			$('#err-search').html('Please enter Event Name');
			$('#err-search').show(500);
			$('#err-search').delay(4000);
		    $('#err-search').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#event_search_name").focus();
		}else if(!name_pattern.test($("#event_search_name").val())){
			$('#err-search').html('Please enter valid Event Name');
			$('#err-search').show(500);
			$('#err-search').delay(4000);
		    $('#err-search').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#event_search_name").focus();
		}
		else
		{
			$("#manage_search_form").submit();
		}
	});
	
	$("#panelist_search_btn").click(function(){
		var name_pattern=/^[A-Za-z0-9][A-Za-z0-9&.)(\-\, ]+$/;
		if($("#panelist_search_name").val()!='' && !name_pattern.test($("#panelist_search_name").val())){
			$('#err-search1').html('Please enter valid Name');
			$('#err-search1').show(500);
			$('#err-search1').delay(4000);
		    $('#err-search1').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#panelist_search_name").focus();
			return false;
		}
		else if($("#affiliation2").val() != '' && !name_pattern.test($("#affiliation2").val())){
			$('#err-search2').html('Please enter valid affiliation');
			$('#err-search2').show(500);
			$('#err-search2').delay(4000);
		    $('#err-search2').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#affiliation2").focus();
			return false;
		}
		else
		{
			$("#manage_search_form1").submit();
		}
	});
	$("#panelist_btn").click(function(){
	//	var name_pattern=/^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,12})$/;
		var mobile_pattern = /^[0-9]{10,15}$/;
		if($("#full_name").val() =="")
		{
			$('#err-name').html('Please enter full name');
			$('#err-name').show(500);
			$('#err-name').delay(4000);
			$('#err-name').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#full_name").focus();
			return false;
		}
		else if($("#email_1").val() =="")
		{
			$('#err-name1').html('Please enter email');
			$('#err-name1').show(500);
			$('#err-name1').delay(4000);
			$('#err-name1').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#email_1").focus();
			return false;
		}
		else if(!name_pattern.test($("#email_1").val()))
		{
			$('#err-name1').html('Please enter valid email');
			$('#err-name1').show(500);
			$('#err-name1').delay(4000);
			$('#err-name1').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#email_1").focus();
			return false;
		}
		else if($("#password_1").val() =="")
		{
			$('#err-name2').html('Please enter password');
			$('#err-name2').show(500);
			$('#err-name2').delay(4000);
			$('#err-name2').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#password_1").focus();
			return false;
		}
		else if($("#confirm_password_1").val() =="")
		{
			$('#err-name3').html('Please enter password');
			$('#err-name3').show(500);
			$('#err-name3').delay(4000);
			$('#err-name3').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#confirm_password_1").focus();
			return false;
		}
		
		else if(!mobile_pattern.test($("#contact_no_1").val()))
		{
			$('#err-name4').html('Please enter correct mobile number');
			$('#err-name4').show(500);
			$('#err-name4').delay(4000);
			$('#err-name4').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#contact_no_1").focus();
			return false;
		}
		else
		{
			$("#panelist_form").submit();
		}
	});
	
	$("#panelist_profile_updatebtn").click(function(){
		var name_pattern=/^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,12})$/;
		var mobile_pattern = /^[0-9]{10,15}$/;
		if($("#full_name").val() =="")
		{
			$('#err-name').html('Please enter Full Name');
			$('#err-name').show(500);
			$('#err-name').delay(4000);
			$('#err-name').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#full_name").focus();
			return false;
		}
		else if($("#email_1").val() =="")
		{
			$('#err-name1').html('Please enter Email');
			$('#err-name1').show(500);
			$('#err-name1').delay(4000);
			$('#err-name1').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#email_1").focus();
			return false;
		}
		else if(!name_pattern.test($("#email_1").val()))
		{
			$('#err-name1').html('Please enter valid email');
			$('#err-name1').show(500);
			$('#err-name1').delay(4000);
			$('#err-name1').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#email_1").focus();
			return false;
		}
		
		else if(!mobile_pattern.test($("#contact_no_1").val()))
		{
			$('#err-name4').html('Please enter correct mobile number');
			$('#err-name4').show(500);
			$('#err-name4').delay(4000);
			$('#err-name4').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#contact_no_1").focus();
			return false;
		}
		else
		{
			$("#panelist_form").submit();
		}
	});
	
	
	$("#award_btn").click(function(){
		var name_pattern=/^[A-Za-z0-9][A-Za-z0-9&\.\:\+\-\.\,\!\@\#\$\%)(\;\\\/\"\'\_\=\? ]+$/;
		var end = $("#enddate").val();
		var endArray = end.split("-");
		var start = $("#startdate").val();
		var startArray = start.split("-");
		if($("#selectevent").val() =="" || $("#selectevent").val() == " ")
		{
			$('#err-event1').html('Please choose Event Name');
			$('#err-event1').show(500);
			$('#err-event1').delay(4000);
		    $('#err-event1').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#selectevent").focus();
		}
		else if($("#awardname").val() =="" || $("#awardname").val() == " ")
		{
			$('#err-award').html('Please enter Award Name');
			$('#err-award').show(500);
			$('#err-award').delay(4000);
		    $('#err-award').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#awardname").focus();
		}
		else if(!name_pattern.test($("#awardname").val())){
			$('#err-award').html('Please enter valid Award Name');
			$('#err-award').show(500);
			$('#err-award').delay(4000);
		    $('#err-award').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#awardname").focus();
		}
		else if($("#admin_select").val() =="" || $("#admin_select").val() == " ")
		{
			$('#err-admin1').html('Please select Admin Incharge Name');
			$('#err-admin1').show(500);
			$('#err-admin1').delay(4000);
		    $('#err-admin1').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#admin_select").focus();
		}
		else if($("#cp_select").val() =="" || $("#cp_select").val() == " ")
		{
			$('#err-pan').html('Please select Chief Panelist');
			$('#err-pan').show(500);
			$('#err-pan').delay(4000);
		    $('#err-pan').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#cp_select").focus();
		}
		else if($("#startdate").val() =="" || $("#startdate").val() == " ")
		{
			$('#err-sdate').html('Please enter start date');
			$('#err-sdate').show(500);
			$('#err-sdate').delay(4000);
		    $('#err-sdate').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#startdate").focus();
		}
		else if($("#enddate").val() =="" || $("#enddate").val() == " ")
		{
			
			
			$('#err-sdate').html('Please enter end date');
			$('#err-sdate').show(500);
			$('#err-sdate').delay(4000);
		    $('#err-sdate').animate({
		      height: 'toggle'  
		    }, 500, function() {
		      // Animation complete.
		    });
			$("#enddate").focus();
		}
		else if(endArray[2] <=  startArray[2]){
			if(endArray[1] <=  startArray[1]){
				if(endArray[0] <=  startArray[0]) {
					$('#err-edate').html('End date cannot be lesser then start date');
					$('#err-edate').show(500);
					$('#err-edate').delay(4000);
					$('#err-edate').animate({
					  height: 'toggle'  
					}, 500, function() {
					  // Animation complete.
					});
					$("#enddate").focus();
				}
			}
			else
			{
				$("#award_form").submit();
			}
		}
		
		else
		{
			$("#award_form").submit();
		}
	});
	
	$('#scopus2,#publication2,#journal,#patents,#conf_pro,#books,#social2').keyup(function(){
		var val = $(this).val();
		if(isNaN(val))
		{
			$(this).val('');
		}
		/*if($(this).val().length <= '2'){
			$(this).val(val+'.00');
			$(this).focus();
		}*/
	});
	
	$("#edit_award_btn").click(function(){
		$("#award_e_form").submit();
	});
	
	$("#award_c_btn").click(function(){
		$("#award_c_form").submit();
	});
	
	$("#award_p_btn").click(function(){
		$("#award_p_form").submit();
	});
	
	$("#faq_btn").click(function(){
		var event = $("#select_event").val();
		var q = $("#faq_q").val();
		var a = $("#faq_a").val();
		if(event == '')
		{
			$('#err-event1').html('Please choose en event');
			$('#err-event1').show(500);
			$('#err-event1').delay(4000);
			$('#err-event1').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#select_event").focus();
		}
		else if(q == '')
		{
			$('#err-faq_q').html('Please enter a question');
			$('#err-faq_q').show(500);
			$('#err-faq_q').delay(4000);
			$('#err-faq_q').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#faq_q").focus();
		}
		else if(a == '')
		{
			$('#err-faq_a').html('Please enter an answer');
			$('#err-faq_a').show(500);
			$('#err-faq_a').delay(4000);
			$('#err-faq_a').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#faq_a").focus();
		}
		else{
			$("#faq_event").val(event);
			$("#faq_form").submit();
		}
	});
	
	$("#video_btn").click(function(){
		var event = $("#select_event").val();
		var n = $("#video_name").val();
		var l = $("#video_link").val();
		if(event == '')
		{
			$('#err-event1').html('Please choose en event');
			$('#err-event1').show(500);
			$('#err-event1').delay(4000);
			$('#err-event1').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#select_event").focus();
		}
		else if(n == '')
		{
			$('#err-video_n').html('Please enter video title');
			$('#err-video_n').show(500);
			$('#err-video_n').delay(4000);
			$('#err-video_n').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#video_name").focus();
		}
		else if(l == '')
		{
			$('#err-video_l').html('Please enter video link');
			$('#err-video_l').show(500);
			$('#err-video_l').delay(4000);
			$('#err-video_l').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#video_link").focus();
		}
		else{
			$("#video_event").val(event);
			$("#video_form").submit();
		}
	});
});

function edit_event(id,url){
	window.location=url+'/modify_event?id='+id+'&type=edit';
}
function delete_event(id,url){
	doIt=confirm('Do you want to delete?');
	if(doIt){
		window.location=url+'/modify_event?id='+id+'&type=delete';
	}else{
		return false;
	}
}
function status_event(id,url,st){
	doIt=confirm('Do you want to change the status of the event?');
	if(doIt){
		window.location=url+'/modify_event?id='+id+'&type='+st;
	}else{
		return false;
	}
}
function edit_award(id,url){
	window.location=url+'/modify_award?id='+id+'&type=edit';
}
function delete_award(id,url){
	doIt=confirm('Do you want to delete?');
	if(doIt){
		window.location=url+'/modify_award?id='+id+'&type=delete';
	}else{
		return false;
	}
}
function edit_panelist(id,url){
	window.location=url+'/modify_panelist?id='+id+'&type=edit';
}
function delete_panelist(id,url){
	doIt=confirm('Do you want to delete?');
	if(doIt){
		window.location=url+'/modify_panelist?id='+id+'&type=delete';
	}else{
		return false;
	}
}
function status_panelist(id,url,st){
	doIt=confirm('Do you want to change the status of the panelist?');
	if(doIt){
		window.location=url+'/modify_panelist?id='+id+'&type='+st;
	}else{
		return false;
	}
}
function delete_faq(id,event,url){
	doIt=confirm('Do you want to delete?');
	if(doIt){
		window.location=url+'/modify_faq?id='+id+'&event='+event;
	}else{
		return false;
	}
}
function delete_video(id,event,url){
	doIt=confirm('Do you want to delete?');
	if(doIt){
		window.location=url+'/modify_videos?id='+id+'&event='+event;
	}else{
		return false;
	}
}
function loadFaq(){
	var val = $("#select_event").val();
	var url = $("#faq_url").val();
	var formData = {event:val};
	if(val == '')
	{
		$('#err-event1').html('Please choose en event');
		$('#err-event1').show(500);
		$('#err-event1').delay(4000);
		$('#err-event1').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#select_event").focus();
	}
	else if(val != '')
	{
		$(location).attr('href', url+'/manage_event_faqs?event='+val);
	}
}
function loadVideo(){
	var val = $("#select_event").val();
	var url = $("#faq_url").val();
	var formData = {event:val};
	if(val == '')
	{
		$('#err-event1').html('Please choose en event');
		$('#err-event1').show(500);
		$('#err-event1').delay(4000);
		$('#err-event1').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#select_event").focus();
	}
	else if(val != '')
	{
		$(location).attr('href', url+'/manage_event_videos?event='+val);
	}
}
/*function hide_show(val1, id)
{
	document.getElementById(id).disabled = val1;
	document.getElementById(id).value = '';
}*/

$(document).ready(function(){
	$("#createadmin").click(function(){
	var name_pattern=/^[A-Za-z0-9][A-Za-z0-9&.)(\-\, ]+$/;	
	var email_pattern=/^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,12})$/;
	var mobile_pattern = /^[0-9 ]{10,15}$/;
	if($("#namefull").val() =="")
		{
		$('#err-name').html('Please enter Full Name');
		$('#err-name').show(500);
		$('#err-name').delay(4000);
		$('#err-name').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#namefull").focus();
		}
	else if(!name_pattern.test($("#namefull").val())){
			$('#err-name').html('Special character are not allowed');
			$('#err-name').show(500);
			$('#err-name').delay(4000);
			$('#err-name').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#namefull").focus();
			}
	else if($("#emailid").val() =="")
		{
		$('#err-name1').html('Please enter Email');
		$('#err-name1').show(500);
		$('#err-name1').delay(4000);
		$('#err-name1').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#emailid").focus();
		}
	else if(!email_pattern.test($("#emailid").val()))
		{
		$('#err-name1').html('Please enter a valid email');
		$('#err-name1').show(500);
		$('#err-name1').delay(4000);
		$('#err-name1').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#emailid").focus();
		}
		
	else if($("#npassword").val() =="")
		{
		$('#err-name2').html('Please enter Password');
		$('#err-name2').show(500);
		$('#err-name2').delay(4000);
		$('#err-name2').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#npassword").focus();
		}
	else if($("#cpassword").val() =="")
		{
		$('#err-name3').html('Please enter Password');
		$('#err-name3').show(500);
		$('#err-name3').delay(4000);
		$('#err-name3').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
	$("#cpassword").focus();
	}
	else if($("#npassword").val() != $("#cpassword").val())
		{
		$('#err-name3').html('Password and confirm password field not matched');
		$('#err-name3').show(500);
		$('#err-name3').delay(4000);
		$('#err-name3').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
	$("#cpassword").focus();
	}
	else if(!mobile_pattern.test($("#cno").val()))
		{
		$('#err-name4').html('Please enter valid mobile number');
		$('#err-name4').show(500);
		$('#err-name4').delay(4000);
		$('#err-name4').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#cno").focus();
		}
	else
		{	$("#createadminform").submit();
		}
	});
});
$(document).ready(function(){
	$("#update_admin").click(function(){
	var name_pattern=/^[A-Za-z0-9][A-Za-z0-9&.)(\-\, ]+$/;	
	var email_pattern=/^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,12})$/;
	var mobile_pattern = /^[0-9]{10,15}$/;
	if($("#namefull").val() =="")
		{
		$('#err-name').html('Please enter Full Name');
		$('#err-name').show(500);
		$('#err-name').delay(4000);
		$('#err-name').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#namefull").focus();
		}
	else if(!name_pattern.test($("#namefull").val())){
			$('#err-name').html('Special character are not allowed');
			$('#err-name').show(500);
			$('#err-name').delay(4000);
			$('#err-name').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#namefull").focus();
			}
	
	else if($("#npassword").val() == $("#cpassword").val()  )
		{
		$('#err-name2').html('Password not Matched');
		$('#err-name2').show(500);
		$('#err-name2').delay(4000);
		$('#err-name2').animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#npassword").focus();
		}
			
	else if(!mobile_pattern.test($("#cno").val()))
			{
			$('#err-name4').html('Please enter valid mobile number');
			$('#err-name4').show(500);
			$('#err-name4').delay(4000);
			$('#err-name4').animate({
			height: 'toggle' 
			}, 500, function() {
			// Animation complete.
			});
			$("#cno").focus();
			}
		else
			{	$("#updateadminform").submit();
			}
	});
	
	$('#addinputs').click(function () {
		var url = $("#img_url").val();
		var o_id = $("#c_counter").val();
		var new_val = parseInt(o_id)+1;
		$("#c_counter").val(new_val);
		var id = 'master_criteria'+new_val;
		var l_name = 'criteria_label'+new_val;
		var l_val = 'criteria_value'+new_val;
		var fun = 'onClick=addSubInput("master_criteria'+new_val+'")';
		var blur = 'onfocusout="validateCriteria($(this).val(), '+new_val+')"';
		var blur1 = 'onfocusout="validateCriteriaVal($(this).val(), '+new_val+')"';
		var display = '<div class="form-inline" id="'+id+'"><div class="space10"></div><div class="form-group col-sm-6 col-md-6 col-lg-6 custom_padding"><input type="text" name="'+l_name+'" class="form-control white input_box" id="'+l_name+'" '+blur+' placeholder="Criteria Label" value=""></div><div class="form-group col-sm-4 col-md-4 col-lg-4 custom_padding">&nbsp;&nbsp;:&nbsp;&nbsp;<input type="text" name="'+l_val+'" id="'+l_val+'" class="form-control white" placeholder="00.00" '+blur1+' value=""></div><div class="form-group col-sm-2 col-md-2 col-lg-2 custom_padding"><div class="add_more" style="float:left;"><img src="'+url+'img/delete.png" alt="Delete Input" onClick="$(this).parent().parent().parent().slideUp(function(){ $(this).remove();}); return false" id="deleteinputs"></div><div style="float:left;margin:6px 0 0 20px;cursor:pointer;font-size:16px;text-decoration:none;"><span class="glyphicon glyphicon-plus" aria-hidden="true" title="Add Sub Criteria" alt="Add Sub Criteria" '+fun+' id="addsubinputs"></span></div><div class="add_more"></div></div><div class="space10"></div></div><div class="clearfix"></div><div class="error error_msg" id="error_div_'+new_val+'"></div>';
		$('#add_criteria').append(display);
	});
});
function addSubInput(parent)
{
	var url = $("#img_url").val();
	var p_id = parent.substr(-1);
	var l_name = 'sub_criteria_l'+p_id+'[]';
	var l_id = 'sub_criteria_l'+p_id;
	var l_val = 'sub_criteria_v'+p_id+'[]';
	var l_val_id = 'sub_criteria_v'+p_id;
	var blur = 'onfocusout="validateSubCriteria($(this).val(), '+p_id+')"';
	var blur1 = 'onfocusout="validateSubCriteriaVal($(this).val(), '+p_id+')"';
	var display = '<div class="form-inline sub_criteria col-sm-10 col-md-10 col-lg-10" style="margin-bottom:0px;"><div class="form-group col-sm-7 col-md-7 col-lg-7 custom_padding"><input type="text" name="'+l_name+'" '+blur+' class="form-control white input_box" id="'+l_id+'" placeholder="Sub Criteria Label" value=""></div><div class="form-group col-sm-4 col-md-4 col-lg-4 custom_padding">&nbsp;&nbsp;:&nbsp;&nbsp;<input type="text" name="'+l_val+'" '+blur1+' id="'+l_val_id+'" class="form-control white" placeholder="00.00" value=""></div><div class="form-group col-sm-1 col-md-1 col-lg-1 custom_padding"><div style="float:left;margin:6px 0 0 20px;cursor:pointer;font-size:16px;text-decoration:none;"><span class="glyphicon glyphicon-minus" aria-hidden="true" title="Delete Sub Criteria" alt="Delete Sub Criteria" onClick="$(this).parent().parent().parent().slideUp(function(){ $(this).remove();}); return false" id="deletesubinputs"></span></div></div></div>';
	$('#'+parent).append(display);
}
function validateCriteria(val, id)
{
	var regex = /^[A-Za-z0-9\.\-_&)( ]+$/;
	var c = id;
	if(val != '' && regex.test(val)==false)
	{
		$("#error_div_"+c).html('Please enter a valid criteria label');
		$("#error_div_"+c).show(500);
		$("#error_div_"+c).delay(4000);
		$("#error_div_"+c).animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#criteria_label"+c).focus();
		return false;
	}
}
function validateCriteriaVal(val1, id1)
{
	var regex = /^[0-9.]+$/;
	var c = id1;
	if(val1 != '' && isNaN(val1) == true && regex.test(val1)==false)
	{
		$("#error_div_"+c).html('Please enter a valid criteria value');
		$("#error_div_"+c).show(500);
		$("#error_div_"+c).delay(4000);
		$("#error_div_"+c).animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#criteria_value"+c).focus();
		return false;
	}
}
function validateSubCriteria(val, id)
{
	var regex = /^[A-Za-z0-9\.\-_&)( ]+$/;
	var c = id;
	if(val != '' && regex.test(val)==false)
	{
		$("#error_div_"+c).html('Please enter a valid sub criteria label');
		$("#error_div_"+c).show(500);
		$("#error_div_"+c).delay(4000);
		$("#error_div_"+c).animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#sub_criteria_l"+c).focus();
		return false;
	}
}
function validateSubCriteriaVal(val1, id1)
{
	var regex = /^[0-9.]+$/;
	var c = id1;
	if(val1 != '' && isNaN(val1) == true && regex.test(val1)==false)
	{
		$("#error_div_"+c).html('Please enter a valid sub criteria value');
		$("#error_div_"+c).show(500);
		$("#error_div_"+c).delay(4000);
		$("#error_div_"+c).animate({
		height: 'toggle' 
		}, 500, function() {
		// Animation complete.
		});
		$("#sub_criteria_v"+c).focus();
		return false;
	}
}
function admin_score(id, path, Width, Height)
{
	var regex = /^[0-9.]+$/;
	var url = path+'/admin_score?award_id='+id;	
	if(id!='' && regex.test(id)==true)
	{
		winLeft = (screen.width-Width)/2;
    	winTop = (screen.height-(Height+110))/2;
    	window.open(url,"_blank","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width="+Width+",height="+Height+",left=" + winLeft + ",top=" + winTop);
	}
}
